﻿<template>
   <div id="land_box">
    <img
      style="position: absolute; width: 100vw; height: 100vh"
      src="../../assets/back.jpg"
    />
    <div class="land_content">
      <div class="mian_box">
        <div class="mian_top">平台管理登陆</div>
        <div class="mian_left">
          <div class="land_li">
            <el-input placeholder="请输入账号" v-model="accountVle">
              <i slot="prefix" class="el-icon-user"></i>
            </el-input>
          </div>
          <div class="land_li">
            <el-input
              placeholder="请输入密码"
              v-model="passwordVle"
              show-password
              @keyup.enter.native="landFn()"
            >
              <i slot="prefix" class="el-icon-goods"></i>
            </el-input>
          </div>
          <button class="land_btn" @click="landFn()">
            登陆
          </button>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { getRoute } from "../../router";
import axios from "axios";
const requestUrl = require("../../util/requestUrl");

export default {
  data() {
    return {
      // 登陆
      accountVle: "",
      passwordVle: "",
    };
  },
  mounted() {
    /* 获取 $api中api的 图片上传接口*/
    this.uploadApi = this.$api.api.uploads;
    /* 获取 抛出来的模块中mubanId*/
    this.mubanId = requestUrl.mubanId;
  },
  methods: {
    //账号登陆
    landFn: function() {
      var _this = this;
      var accountVle = this.accountVle;
      var passwordVle = this.passwordVle;
      console.log(accountVle,passwordVle);
      if (!accountVle) {
        this.$message.error("账号不能为空");
        return false;
      }
      if (!passwordVle) {
        this.$message.error("密码不能为空");
        return false;
      }
      if (accountVle != 'admin') {
        this.$message.error("账号错误");
        return false;
      } else if (passwordVle != '123456') {
        this.$message.error("密码错误");
      } else{
        let urls = "/list/rotation";
        var isLogin = -1;
        var router = getRoute(-1);
        localStorage.setItem("isLogin", isLogin);
        _this.$router.options.routes = router;
        _this.$router.addRoutes(router);
        _this.$router.push(urls);
        this.$message.success("登陆成功！");
      }
    }
  }
};
</script>

<style scoped lang="less">
#land_box {
  width: 100vw;
  height: 100vh;

  .land_top {
    width: 100%;
    height: 60px;
    background: #000;
    color: #fff;
    display: flex;
    align-items: center;

    .land_top_mian {
      width: 1200px;
      margin: auto;
      font-family: "黑体";
      line-height: 40px;
      font-size: 17px;
      span {
        font-weight: bold;
      }
    }
  }

  .el-button.is-loading {
    width: 90%;
    margin: 15px auto;
  }

  .land_content {
    width: 1200px;
    min-height: 775px;
    margin: auto;
    line-height: 40px;

    .mian_box {
      width: 300px;
      height: 260px;
      border: 1px solid #eeeeee;
      position: absolute;
      transform: translate(-50%, -50%);
      top: 45%;
      left: 50%;
      padding: 0px 20px;
      text-align: center;

      .mian_top {
        width: 100%;
        height: 60px;
        line-height: 60px;
        font-size: 15px;
        font-weight: bold;
        border-bottom: 1px solid #eeeeee;
        color: #fff;
      }

      .mian_left {
        width: 95%;
        height: 260px;
        float: left;
        padding: 10px 2%;

        .mian_left_title {
          width: 100%;
          height: 40px;
          line-height: 40px;
          display: flex;
          justify-content: space-around;
          border-bottom: 1px solid #eeeeee;
          font-size: 15px;
          cursor: pointer;
        }

        .land_li {
          width: 90%;
          margin: 15px auto;
        }

        .land_btn {
          width: 90%;
          height: 40px;
          line-height: 40px;
          background: #17a1f6;
          text-align: center;
          margin: auto;
          border-radius: 5px;
          cursor: pointer;
          display: block;
          border: 0;
          font-size: 15px;
          color: #fff;
          padding: 0;
        }
      }

      .mian_right {
        width: 49%;
        height: 260px;
        float: left;
        border-left: 1px solid #eeeeee;

        img {
          width: 220px;
          margin: auto;
          display: block;
          padding-top: 50px;
          box-sizing: border-box;
        }

        .text {
          width: 100%;
          text-align: center;
          font-size: 16px;
          letter-spacing: 3px;
        }
      }
    }
  }

  .land_bottom {
    width: 100%;
    height: 100px;
    line-height: 100px;
    border-top: 2px solid #000;
    background: #f7f8f9;
    text-align: center;
    font-size: 15px;
  }
}
</style>